package com.kx.yooli.kx.wechat.mapper.bill;

import com.kx.yooli.kx.wechat.entity.bill.BillEntity;
import com.mybatisflex.annotation.UseDataSource;
import com.mybatisflex.core.BaseMapper;
import com.mybatisflex.core.query.QueryColumn;
import com.mybatisflex.core.query.QueryCondition;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author john_sqwen-childe.wen
 * @date 2024/4/1
 * @PROJECT_NAME wechat
 * @description create BillMapper by john_sqwen
 * and billMapper value is
 */
public interface BillMapper extends BaseMapper<BillEntity> {

    @UseDataSource("ds2")
    @Select("select  loan_no from kx_repayment.repayment_info where cert_no =#{jdbcType=VARCHAR} group by loan_no")
    List<String> selectLoanNoByCertNo(String certNo);



    default List<BillEntity> selectQueryDataByCertNo(String certNo){
        //where("cert_no=" + "'"+certNo+"'")
        QueryColumn queryColumn = new QueryColumn("kx_repayment","repayment_info", "cert_no");
        return  selectListByCondition(QueryCondition.create(queryColumn,"=",certNo));
    }
    default BillEntity selectLoanByCertNo(String certNo){
        QueryColumn queryColumn = new QueryColumn("kx_repayment","repayment_info", "cert_no");
        return   selectOneByCondition(QueryCondition.create(queryColumn,"=",certNo));
    }
}
